*/
u64 serial_nr;
- /*
- * Incremented by online self and children. Used to guarantee that
- * parents are not offlined before their children.
- */
- atomic_t online_cnt;
-
/* percpu_ref killing and RCU release */
struct rcu_head rcu_head;
struct work_struct destroy_work;
INIT_LIST_HEAD(&css->sibling);
INIT_LIST_HEAD(&css->children);
css->serial_nr = css_serial_nr_next++;
- atomic_set(&css->online_cnt, 0);
if (cgroup_parent(cgrp)) {
css->parent = cgroup_css(cgroup_parent(cgrp), ss);
if (!ret) {
css->flags |= CSS_ONLINE;
rcu_assign_pointer(css->cgroup->subsys[ss->id], css);
-
- atomic_inc(&css->online_cnt);
- if (css->parent)
- atomic_inc(&css->parent->online_cnt);
}
return ret;
}
container_of(work, struct cgroup_subsys_state, destroy_work);
mutex_lock(&cgroup_mutex);
-
- do {
- offline_css(css);
- css_put(css);
- /* @css can't go away while we're holding cgroup_mutex */
- css = css->parent;
- } while (css && atomic_dec_and_test(&css->online_cnt));
-
+ offline_css(css);
mutex_unlock(&cgroup_mutex);
+
+ css_put(css);
}
/* css kill confirmation processing requires process context, bounce */
struct cgroup_subsys_state *css =
container_of(ref, struct cgroup_subsys_state, refcnt);
- if (atomic_dec_and_test(&css->online_cnt)) {
- INIT_WORK(&css->destroy_work, css_killed_work_fn);
- queue_work(cgroup_destroy_wq, &css->destroy_work);
- }
+ INIT_WORK(&css->destroy_work, css_killed_work_fn);
+ queue_work(cgroup_destroy_wq, &css->destroy_work);
}
/**